<template>
	<view class="wrap">
		<uni-card title="基础卡片" extra="额外信息">
		    <text>这是一个基础卡片示例，此示例展示了一个标题加标题额外信息的标准卡片。</text>
		</uni-card>
		<uni-group mode="card" title="通勤数据">
			<uni-grid :column="3" :show-border="false" :square="false" @change="change">
				<uni-grid-item index="0">
					<view class="grid-item-box">
						<u-count-to :end-val="500"></u-count-to>
						<text class="text">缺勤教师</text>
					</view>
				</uni-grid-item>
				<uni-grid-item index="1">
					<view class="grid-item-box">
						<u-count-to :end-val="500"></u-count-to>
						<text class="text">请假学生</text>
					</view>
				</uni-grid-item>
				<uni-grid-item index="2">
					<view class="grid-item-box">
						<u-count-to :end-val="500"></u-count-to>
						<text class="text">访客人数</text>
					</view>
				</uni-grid-item>
			</uni-grid>
		</uni-group>
		<uni-group mode="card" title="一周总览">
			<qiun-data-charts type="demotype" :chartData="chartData" />
		</uni-group>
		<uni-group mode="card" title="监控数据">
			<uni-grid :column="3" :show-border="false" :square="false">
				<uni-grid-item>
					<view class="grid-item-box">
						<u-count-to :end-val="500"></u-count-to>
						<text class="text">体温异常</text>
					</view>
				</uni-grid-item>
				<uni-grid-item>
					<view class="grid-item-box">
						<u-count-to :end-val="500"></u-count-to>
						<text class="text">抓拍次数</text>
					</view>
				</uni-grid-item>
				<uni-grid-item>
					<view class="grid-item-box">
						<u-count-to :end-val="500"></u-count-to>
						<text class="text">访客人数</text>
					</view>
				</uni-grid-item>
			</uni-grid>
		</uni-group>
		<s-footer></s-footer>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				chartData: {
					"categories": [
						"周一",
						"周二",
						"周三",
						"周四",
						"周五"
					],
					"series": [{
							"name": "缺勤教师",
							"data": [
								35,
								8,
								25,
								37,
								4
							]
						},
						{
							"name": "请假学生",
							"data": [
								70,
								40,
								65,
								100,
								44
							]
						},
						{
							"name": "访客人数",
							"data": [
								100,
								80,
								95,
								150,
								112
							]
						}
					]

				}
			}
		},
		methods: {
			change(e) {
				console.log(e)
				let index = e.detail.index
				if (index === '0') {

				} else if (index === '1') {

				} else if (index === 2) {
					uni.navigateTo({
						url: '../visitor/pages'
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.grid-item-box {
		flex: 1;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 10px;

		.text {
			font-size: 28rpx;
			margin-top: 10rpx;
			color: $u-type-info;
		}
	}
</style>
